package com.hibase.common.exception;


import cn.hutool.json.JSONUtil;
import com.hibase.common.constant.ExceptionCode;

import java.util.Map;

/**
 * hibase Excel异常类
 *
 * @author hufeng
 * @date 2019/01/18
 */
public class HibaseExcelException extends HibaseException {
    /**
     * NotNull.
     */
    private Integer rowIndex;
    /**
     * NotNull.
     */
    private Integer columnIndex;
    /**
     * NotNull.
     */
    private Map<String, Object> cellData;
    /**
     * Nullable.Only when the header is configured and when the class header is used is not null.
     */
    private Map<String, Object> excelContentProperty;
    /**
     * 状态码
     */
    protected int code = ExceptionCode.DEFAULT_EXCEPTION.getCode();

    public HibaseExcelException() {
        super();
    }

    public HibaseExcelException(String message) {
        super(message);
    }

    public HibaseExcelException(int code, String message) {
        super(code, message);
    }

    public HibaseExcelException(String message, Throwable cause) {
        super(message, cause);
    }

    public HibaseExcelException(int code, String message, Throwable cause) {
        super(code, message, cause);
    }

    public HibaseExcelException(Throwable cause) {
        super(cause);
    }

    public HibaseExcelException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }


    public HibaseExcelException(Integer rowIndex, Integer columnIndex, Object cellData,
                                Object excelContentProperty, String message) {
        super(message);
        this.rowIndex = rowIndex;
        this.columnIndex = columnIndex;
        this.cellData = JSONUtil.parseObj(cellData);
        this.excelContentProperty = JSONUtil.parseObj(excelContentProperty);
    }

    public HibaseExcelException(Integer rowIndex, Integer columnIndex, Object cellData,
                                Object excelContentProperty, String message, Throwable cause) {
        super(message, cause);
        this.rowIndex = rowIndex;
        this.columnIndex = columnIndex;
        this.cellData = JSONUtil.parseObj(cellData);
        this.excelContentProperty = JSONUtil.parseObj(excelContentProperty);
    }


}
